package com.zmn.oms.dubbo.impl.zmn.orderworkingrecord;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.oms.common.dio.orderworkingrecord.OrderWorkingRecordDIO;
import com.zmn.oms.common.exception.OmsBusinessException;
import com.zmn.oms.dubbo.interfaces.zmn.orderworkingrecord.OrderWorkingRecordModifyRemoteService;
import com.zmn.oms.dubbo.utils.DubboConsts;
import com.zmn.oms.zmn.business.interfaces.orderworkingrecord.OrderWorkingRecordBService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 * 上门录音修改远程服务
 *
 * @author chengguang
 * @date 2022/07/22
 */
@DubboService(version = DubboConsts.INTERFACE_VERSION, validation = "true")
@Slf4j
public class OrderWorkingRecordModifyRemoteServiceImpl implements OrderWorkingRecordModifyRemoteService {

    @Resource
    private OrderWorkingRecordBService orderWorkingRecordBService;

    @Override
    public ResponseDTO<Boolean> addOrderWorkingRecord(OrderWorkingRecordDIO orderWorkingRecordDIO) {
        try {
            log.info("OrderWorkingRecordModifyRemoteService#addOrderWorkingRecord入参orderWorkingRecordDIO：{}", orderWorkingRecordDIO);
            return ResponseDTO.success(orderWorkingRecordBService.addOrderWorkingRecord(orderWorkingRecordDIO));
        } catch (OmsBusinessException e) {
            return ResponseDTO.fail(e.getMessage());
        } catch (Exception e) {
            log.error("OrderWorkingRecordModifyRemoteService#addOrderWorkingRecord失败,{}", e.getMessage(), e);
            return ResponseDTO.fail("新增上门录音失败");
        }
    }
}
